<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>
		<!-- <div id="">
			<div id="">
				<label>
					请输入你的qq号：<input type="text" name="" id="ipt1" value="" />
				</label>
				<br />
				<button type="button" id="btn1">检测是否输入正确</button>
				<br />
				<span id="info">

				</span>
			</div>
			<div id="">
				<label>
					请输入你的手机号：<input type="text" name="" id="ipt2" value="" />
				</label>
				<br />
				<button type="button" id="btn2">检测是否输入正确</button>
				<br />
				<span id="info1">

				</span>
			</div>
		</div> -->

		<script type="text/javascript">
			/* 	var str = "abcdfegaCdDc";
		var reg1 = /c/gi;
		var arr1 = str.match(reg1);
		console.log(arr1); */
			/* Array(3)0: "c"1: "C"2: "c"length: 3__proto__: Array(0)	 */


			//QQ号  6-12位

			/* var btn1 = document.getElementById("btn1");
			var info = document.getElementById("info");
			btn1.onclick = function() {
				var ipt1 = document.getElementById("ipt1");
				var str = ipt1.value;
				var reg1 = /^\d{6,11}$/;
				var f1 = reg1.test(str);
				console.log(f1);
				info.innerHTML = f1 ? "输入正确,请继续" : "格式错误";

				var reg2 = /^[0-9]{6,11}$/;
				var f2 = reg2.test(str);
				console.log(f2);

				var reg3 = new RegExp("^\\d{6,11}$"); //有引号要加\
				var f3 = reg3.test(str);
				console.log(f3);
			} */


			//手机号 
			//1.都是1开头
			//2.第二位数字只能是3,4,5,6,7,8,9
			//3.必须是11位
		/* 	var btn2 = document.getElementById("btn2");
			var info1 = document.getElementById("info1");
			var ipt2 = document.getElementById("ipt2");
			ipt2.onchange = function() {
				var phone = this.value;
				var reg1 = /^1[3456789]\d{9}$/;
				var f1 = reg1.test(phone);
				info1.innerHTML = f1 ? "输入正确,请继续" : "格式错误";
			}
 */
			//3.判断文件类型 .html .HTML

			
				/* var str1 = "a.html";
				var str2 = "b.HTML";
				var str3 = "c.htm";
				var str4 = "b.HTM";
				var reg1 = /.(html|HTML)$/;
				//var reg1 = /(\.html|\.HTML)$/;
				var f1 = reg1.test(str1);
				console.log(f1); //true
				var f2 = reg1.test(str2);
				console.log(f1); //true
				var f3 = reg1.test(str3);
				console.log(f3); //false
				var f4 = reg1.test(str4);
				console.log(f4); //false
 */

			//判断是否为汉字  ？？

			
				/* var str1 = "a";
				var str2 = "啊";
				var reg = /[\u4e00-\u9fa5]+$/;
				var f1 = reg.test(str1);
				console.log(f1);   //false
				var f2 = reg.test(str2);
				console.log(f2);  //true */

			//判断网址
			/* 
			 1.www开始
			 2.(.)后面是字母(一个或多个)
			 3.点后面是com/cn/vip/
			 
			 */

			
				/* var url1 = "www.badu.com";
				var url2 = "weww.badu.com";
				var reg = /^www\.[A-z]+\.[(com|cn|vip)]/;

				//转义字符
				var f1 = reg.test(url1);
				console.log(f1); //true
				var f2 = reg.test(url2);
				console.log(f2); //false */

			//密码强度
			/* 
			 1.初级 纯数字 纯小写 纯大小  长度6到16
			 2.中级  字母加数字
			 3.高级  字母加数字+ _@#$
			 */
			
			/* var str1 = "123456"
			var str2 = "aaaadS"
			var str3 = "AAAASSS"
			var reg1 = /^(\d{6,16}|[a-z]{6,16}|[A-Z]{6,16})/;
			var f1 = reg1.test(str1);
			var f2= reg1.test(str2);
			var f3 = reg1.test(str3);
			console.log(f1,f2,f3);  //true false true */
			
		/* 	
			var str1 = "123456a"
			var str2 = "aaaadS"
			var str3 = "123456"
			var reg1 = /^([0-9a-zA-Z]{6,16})$/;
			var f1 = reg1.test(str1);
			var f2= reg1.test(str2);
			var f3 = reg1.test(str3);
			console.log(f1,f2,f3); //true true true﻿ */
			
		/* 	var str1 = "123456%#@$_"
			var str2 = "aaaadS?"
			var str3 = "AAAASSS"
			var reg1 = /^([0-9a-zA-Z_!@$#%]{6,16})$/;
			var f1 = reg1.test(str1);
			var f2= reg1.test(str2);
			var f3 = reg1.test(str3);
			console.log(f1,f2,f3);   //true false true
			 */
			
		</script>
	</body>
</html>
